﻿using System;
using System.Collections.Generic;
using System.Text;
using System.IO;

    public class ReadTextFile
    {

        public string title = "";
        public string allText = "";
        public string summary = "";
        public StreamReader streamReader = null;

        public ReadTextFile(FileInfo f)
        {
            ExtractFile ef = null;

            string extension = f.Extension.ToUpper();
            switch (extension)
            {
                case ".RTF":
                case ".DOC":
                case ".DOCX":
                    ef = new docxFile(f);
                    break;

                //case ".XLS":
                //case ".XLSX":
                //    ef = new xlsxFile(f);
                //    break;

                //case ".PPT":
                //case ".PPTX":
                //    ef = new pptxFile(f);
                //    break;

                //case ".PDF":
                //    ef = new pdfFile(f);
                //    break;

                //case ".HTM":
                //case ".HTML":
                //    ef = new htmlFile(f);
                //    break;
            }

            //
            if (ef != null)
            {
                title = f.Name.Replace(f.Extension, "");
                allText = ef.getAllText;
            }
            else //other
            {
                title = f.Name.Replace(f.Extension, "");
                allText = File.ReadAllText(f.FullName, Encoding.Unicode);
            }
            //return allText; 
        }
    }
